//-------------------------------------------------
template<typename T>
CSingleton<T>::CSingleton()
{
	assert(!m_pSingleton);

#if defined( _MSC_VER ) && _MSC_VER < 1200	 
	int offset = (int)(T*)1 - (int)(CSingleton <T>*)(T*)1;
	m_pSingleton = (T*)((int)this + offset);
#else
	m_pSingleton = static_cast<T*>(this);
#endif
}

//-------------------------------------------------
template<typename T>
CSingleton<T>::~CSingleton()
{
	assert(m_pSingleton);
	m_pSingleton = 0;
}